package org.dromara.company.controller;

import lombok.RequiredArgsConstructor;
import org.dromara.admin.service.IHomeService;
import org.dromara.common.core.domain.R;
import org.dromara.common.satoken.utils.LoginHelper;
import org.dromara.common.web.core.BaseController;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * 公司端首页面板数据统计
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/company/home")
public class HomeController extends BaseController {

    private final IHomeService homeService;

    /**
     * 首页面板数据统计
     */
    @GetMapping("/summary")
    public R<Map<String, Object>> getSummary() {
        // 获取当前登录用户
        Long employeeId = LoginHelper.getUserId();

        // 获取统计结果
        Map<String, Object> data = homeService.getCompanySummary(employeeId);
        return R.ok(data);
    }
}
